const http = uni.$u.http
import { baseUrl } from "../common/http.interceptor";

export default {
    /**
     * 用户
     */
    uploadImage: baseUrl + '/upload/file',
    getUserInfo: (id) => http.get('/user/' + id),
    getUserList: (params) => http.get('/user/children', params),
    getUserQrCode: (params) => http.get('/user/wx/getUserQrCode', params),
    getInviteQrCode: (params) => http.get('/user/wx/getUserQrCode', params),
    updateUser: (id, data) => http.put('/user/' + id, data),
    wxLogin: (data) => http.post('/user/wx/login', data),
    getBannerList: (params) => http.get('/banner/list', params),
    getTicketShopList: (params) => http.get('/ticketShop/list', params),
    getTicketShopPage: (params) => http.get('/ticketShop', params),
    getTicketShopDetail: (id) => http.get(`/ticketShop/${id}`),
    getTicketLineList: (params) => http.get('/ticketLine/list', params),
    getTicketLinePage: (params) => http.get('/ticketLine', params),
    getTicketLineDetail: (id) => http.get(`/ticketLine/${id}`),
    createTicketLineRecord: (data) => http.post(`/ticketLineRecord`, data),
    getTicketLineRecordList: (data) => http.get(`/ticketLineRecord/list`, data),
    getPostPage: (params) => http.get('/post', params),
    getPostDetail: (id) => http.get(`/post/${id}`),
    addPost: (data) => http.post(`/post`, data),
    getPostCommentList: (data) => http.get(`/postComment/list`, data),
    createPostComment: (data) => http.post(`/postComment`, data),
    getBalanceRecordPage: (params) => http.get('/balanceRecord', params),
    getBalanceRecordList: (params) => http.get('/balanceRecord/list', params),
    getUserDistributionList: (params) => http.get('/distribution/list', params),
    createUserDistribution: (data) => http.post(`/distribution`, data),
    updateUserDistribution: (id, data) => http.put(`/distribution/${id}`, data),
    getProductCategoryList: (params) => http.get('/productCategory/list', params),
    getProductList: (params) => http.get('/product/list', params),
    getProductDetail: (id) => http.get(`/product/${id}`),
    addCart: (data) => http.post(`/cart`, data),
    getCartList: (data) => http.get(`/cart`, data),
    deleteCart: (data) => http.post(`/cart/batchDelete`, data),
    updateCart: (data) => http.put(`/cart/` + data.id, data),
    updateCartStatusAll: (data) => http.post(`/cart/statusAll`, data),
    updateAddress: (data) => http.put(`/address/` + data.id, data),
    getAddressList: (data) => http.get(`/address`, data),
    addAddress: (data) => http.post(`/address`, data),
    getAddressDetail: (id) => http.get(`/address/${id}`),
    deleteAddress: (id) => http.delete(`/address/${id}`),
    // 章节
    getChapterList: (params) => http.get('/productItem', params),
    // 章节详情
    getChapterDetail: (id) => http.get(`/productItem/${id}`),
    // 获取评论
    getCommentList: (data) => http.get(`/comment`, data),
    // 发表评论
    addComment: (data) => http.post(`/comment`, data),
    // 我的收藏商品
    getCollect: (data) => http.get(`/collection/product`, data),
    getCollectionList: (data) => http.get(`/collection`, data),
    updateCollect: (data) => http.post(`/collection`, data),
    // 订单
    createOrder: (data) => http.post(`/order`, data),
    deleteOrder: (id) => http.delete(`/order/${id}`),
    getOrderList: (data) => http.get(`/order`, data),
    getOrderDetail: (id) => http.get(`/order/${id}`),
    getOrderCodeList: (data) => http.get(`/orderCode/list`, data),
    createPay: (data) => http.post(`/payment/wx`, data),
    cancelOrder: (data) => http.post(`/order/cancel`, data),
    refundOrder: (data) => http.post(`/order/refund`, data),
    // 优惠券列表
    getCouponList: (data) => http.get(`/userCoupon/list`, data),

    // 核销
    checkCode: (data) => http.post(`/orderCode/verify`, data),
    getCheckCodeRecords: (data) => http.get(`/orderCode`, data),
    getDailyCheckStats: (data) => http.get(`/orderCode/dailyStats`, data),

    // 提现
    createWithdraw: (data) => http.post(`/balanceRecord/withdraw`, data),
    getTodayWithdrawTotal: (data) => http.get(`/balanceRecord/todayTotal`, data),
}
